/*
 * texturegrammar.h
 *
 *  Created on: 15/11/2012
 *      Author: cvan680
 */

#ifndef MFTG_TEXTUREGRAMMAR_H_
#define MFTG_TEXTUREGRAMMAR_H_

#include "rule.h"

using std::string;
using std::vector;

namespace voreen{

class TextureGrammar{

public:
	TextureGrammar(string filename);

	void run();

	int getNumberOfNodes();
	int getNumberOfFields();
	TechniqueWrapper getNode(int index);

	bool completed();
	void setForReRun();

	string readFile(string fname);
	void printState();
	void printFileContents();
	std::vector<string> tokenize(string contents, string delimiter);
	std::vector<string> clearComments(std::vector<string> lines);
	std::vector<Rule*> makeRules(std::vector<string> lines);
	string trimmer(string s);


private:
	string filename_;
	string filecontents_;
	std::vector<string> contents_;
	vector<Rule*> rules_;
	NodeList currentState_;

	bool hasrun_;

};

}


#endif /* MFTG_TEXTUREGRAMMAR_H_ */
